package cn.tedu.jdbc;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Scanner;

public class JDBCDemo4 {
    public static void main(String[] args) throws SQLException {
        Connection connection=DBUtil.getConnertion();//创建数据库链接工具类
        Statement statement=connection.createStatement();// 调用statement
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输出要删除的用户名");
        String username=scanner.nextLine();
        String sql="DELETE FROM  userinfo WHERE username='"+username+"';";
        int i=statement.executeUpdate(sql);
        if (i>0){
            System.out.println("输入失败");
        }else {
            System.out.println("删除失败");
        }

    }
}
